package cate.common.table.trademall.treasuresupply;

import cate.common.table.ESheet;
import easy.java.dev.note.NoteClass;

@NoteClass(value = "交易坊-礼包补给商品配置 Sheet")
public class TreasureSupplyItemSheet extends ESheet<TreasureSupplyItemRow> {
    /**
     * 重置类型-从不重置
     */
    public static final int TREASURE_SUPPLY_ITEM_RESET_TYPE_NONE = 0;
    /**
     * 重置类型-每日重置
     */
    public static final int TREASURE_SUPPLY_ITEM_RESET_TYPE_DAY = 1;
    /**
     * 重置类型-每周重置
     */
    public static final int TREASURE_SUPPLY_ITEM_RESET_TYPE_WEEK = 2;
    /**
     * 重置类型-每月重置
     */
    public static final int TREASURE_SUPPLY_ITEM_RESET_TYPE_MONTH = 3;

    /**
     * 消耗类型-免费
     */
    public static final int TREASURE_SUPPLY_ITEM_COST_TYPE_FREE = 0;
    /**
     * 消耗类型-资源
     */
    public static final int TREASURE_SUPPLY_ITEM_COST_TYPE_RES = 1;
    /**
     * 消耗类型-直购
     */
    public static final int TREASURE_SUPPLY_ITEM_COST_TYPE_RMB = 2;

    @Override
    public String getSheetName() {
        return "礼包补给商品配置";
    }

    @Override
    protected void onLoaded() {
        super.onLoaded();
        for (TreasureSupplyItemRow row : getList()) {
            if (row.supplyId == 0) {
                getContext().warningOnSheetLoading(parent.getFileName(), getSheetName(), "ID=" + row.id + " 主表ID配置错误");
            }
            if (row.rewardStr == null || row.rewardStr.isEmpty()) {
                getContext().warningOnSheetLoading(parent.getFileName(), getSheetName(), "ID=" + row.id + " 奖励配置错误");
            }
            switch (row.costType) {
                case TREASURE_SUPPLY_ITEM_COST_TYPE_FREE:
                    if (row.costStr != null && !row.costStr.isEmpty()) {
                        getContext().warningOnSheetLoading(parent.getFileName(), getSheetName(), "ID=" + row.id + " 消耗类型=0, 但是配置了购买消耗");
                    }
                    break;
                case TREASURE_SUPPLY_ITEM_COST_TYPE_RES:
                    if (row.costStr == null || row.costStr.isEmpty()) {
                        getContext().warningOnSheetLoading(parent.getFileName(), getSheetName(), "ID=" + row.id + " 消耗类型=1, 但是未配置购买消耗");
                    }
                    break;
                case TREASURE_SUPPLY_ITEM_COST_TYPE_RMB:
                    break;
                default:
                    getContext().warningOnSheetLoading(getSheetName(), "ID=" + row.id + " 消耗类型配置错误");
            }
        }
    }
}
